import java.util.*;

/**
 * @author gao
 * @date 2025/6/2 16:49)
 */

public class Main {
    public static void main(String[] args) throws InterruptedException {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            Factorial fac = new Factorial(sc.nextInt());
            Thread th = new Thread(fac);//创建线程
            th.start();//启动线程
            th.join();//等待线程结束
            System.out.println(fac.getFactorial());//输出阶乘
        }
    }
}

//通过实现接口来定义线程类，在线程体执行阶乘计算。
class Factorial implements Runnable {
    private int n;
    private long factorial;

    Factorial(int n) {
        this.n = n;
    }

    public long getFactorial() {
        return factorial;
    }


    @Override
    public void run() {
        factorial = 1;
        for (int i = 2; i <= n; i++)
            factorial = factorial * i;
    }
}